<?php


namespace app\common\model\mysql;


use think\Model;

class Category extends Model
{
    public function getNormalCategories($field = '*')
    {
        return $this->where(['status' => 1])
            ->field($field)
            ->order($order = [
                'listorder' => 'desc',
                'id' => 'desc',
            ])
            ->select();
    }

    public function getLists($data, $num = 10)
    {
        $order = [
            'listorder' => 'desc',
            'id' => 'desc',
        ];

        return $this->where($data)->where('status', '<>', 99)->order($order)->paginate($num);
    }

    public function getNormalByPid($pid = 0, $field)
    {
        $order = [
            'listorder' => 'desc',
            'id' => 'desc',
        ];

        return $this->where('status', '<>', 99)->where(['pid' => $pid])->field($field)->order($order)->select();
    }

    public function getCate($id)
    {
        dd($this->where('pid', 'in', [$id])->where(['status' => 1])->select());
        return ;
    }

}